package com.sunfield.windpower.fragment;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.sunfield.baseframe.base.BaseFragment;
import com.sunfield.windpower.R;
import com.sunfield.windpower.adapter.ContactsAdapter;
import com.sunfield.windpower.bean.ContactInfo;
import com.sunfield.windpower.bean.DepartmentInfo;
import com.sunfield.windpower.decoration.ContactsDecoration;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.ViewById;

import java.util.ArrayList;
import java.util.List;

/**
 * 首页 通讯录
 * Created by wxl on 2017/2/6.
 */
@EFragment(R.layout.fragment_contact)
public class ContactsFragment extends BaseFragment {
    @ViewById
    RecyclerView rv_list;
    @Bean
    ContactsAdapter adapter;

    @AfterViews
    void init() {
        rv_list.setLayoutManager(new LinearLayoutManager(getActivity()));
        rv_list.addItemDecoration(new ContactsDecoration(getActivity()));
        rv_list.setAdapter(adapter);

        List<DepartmentInfo> departmentInfos = new ArrayList<>();
        departmentInfos.add(new DepartmentInfo("集团总公司", "1981"));
        departmentInfos.add(new DepartmentInfo("分公司", "596"));
        departmentInfos.add(new DepartmentInfo("管理中心", "221"));
        adapter.setDepartmentList(departmentInfos);

        List<ContactInfo> contactInfos = new ArrayList<>();
        for(int i=0;i<1;i++){
            contactInfos.add(new ContactInfo("Gary", "gary@cnegroup.com", "部门主管"));
            contactInfos.add(new ContactInfo("韩明一", "hanmingyi@cnegroup.com", ""));
            contactInfos.add(new ContactInfo("李雷", "lilei@cnegroup.com", ""));
        }
        adapter.setContactList(contactInfos);
    }
}
